import config from "@/config"
import http from "@/utils/request"
/**
 * 供应商产品
 */
export default {
  selectVendorProductsList: {
    url: `${config.API_URL}/vendorProducts/list`,
    name: "获取供应商产品列表",
    get: function (data = {}) {
      return new Promise((resolve, reject) => {
        http.get(this.url, data).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },
  addVendorProducts: {
    url: `${config.API_URL}/vendorProducts/add`,
    name: "添加产品",
    post: function (data = {}) {
      return new Promise((resolve, reject) => {
        http.post(this.url, data).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },
  editVendorProducts: {
    url: `${config.API_URL}/vendorProducts/update`,
    name: "修改产品",
    post: function (data = {}) {
      return new Promise((resolve, reject) => {
        http.post(this.url, data).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },
  deleteVendorProducts: {
    url: `${config.API_URL}/vendorProducts/delete`,
    name: "删除产品",
    post: function (data = {}) {
      return new Promise((resolve, reject) => {
        http.postParam(this.url, data).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },

  getVendorProductDetail: {
    url: `${config.API_URL}/vendorProducts/detail`,
    name: "获取产品详情",
    get: function (data = {}) {
      return new Promise((resolve, reject) => {
        http.get(this.url, data).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  }
}